package Managers;

import java.util.ArrayList;
import java.util.Calendar;

import CalendarComponents.Reminder;

public class Appointment implements Comparable<Appointment>
{
	/*
	 * Nothing fancy in this class just come attributes with a bunch of getters and setters.
	 */
	private String aName;
	private Calendar start;
	private Calendar finish;
	private String description;
	private String place;
	private Category cat = Category.None();
	//(Chris) A "deleted"-flag so the PropertiesDialog can set it if the user tells it to delete the appointment
	private boolean deleted;
	//(Chris) A list of reminders assigned to this appointment, if size()==0, no reminders set-up.
	private ArrayList<Reminder> reminders = new ArrayList<Reminder>();
	//(Chris) An Object of type repeat that stores all settings for repeting appointments. If null, no repeats set-up.
	private Repeat repeat;
	
	/*CONSTRUCTORS
	 * 
	 */
	
	public Appointment(String name, Calendar date, String desc)
	{
		this(name, date, desc, Category.None());
	}

	public Appointment(String name, Calendar date, String desc, Category c)
	{
		this(name, date, null, desc, c);
	}
	
	public Appointment(String name, Calendar s, Calendar e, String desc, Category c)
	{
		setApointmentName(name);
		setStart(s);
		setFinish(e);
		setDescription(desc);
		cat = c;
	}
	public Appointment(Appointment a)
	{
		setApointmentName(a.getApointmentName());
		this.setStart(a.getStart());
		this.setFinish(a.getFinish());
		this.setDescription(a.getDescription());
		this.setCategory(a.getCategory());
		this.setReminders(a.getReminders());
		this.setRepeat(a.getRepeat());
		this.setDeleted(a.isDeleted());
		this.setPlace(a.getPlace());
	}
	
	/*Get a static appointment
	 * 
	 */
	
	public static Appointment None()
	{
		return new Appointment(
				"Failed",
				CalendarManager.getToday(),
				CalendarManager.getToday(),
				"Desssc",
				Category.None());
	}
	
	
	/*STANDARD METHODS + GETTERS + SETTERS
	 *
	 */
	
	@Override
	public int compareTo(Appointment o) {
		return start.compareTo(o.getStart());
	}

	public void setStart(Calendar s) {
		this.start = s;
	}

	public Calendar getStart() {
		return start;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getDescription() {
		return description;
	}
	
	public String getApointmentName()
	{
		return aName;
	}
	
	public void setApointmentName(String a)
	{
		aName = a;
	}

	public String toString()
	{
		return aName;
	}

	public void setFinish(Calendar e) {
		this.finish = e;
	}

	public Calendar getFinish() {
		return finish;
	}

	public boolean isDeleted() {
		return deleted;
	}

	public void setDeleted(boolean deleted) {
		this.deleted = deleted;
	}

	public Category getCategory() {
		return cat;
	}

	public void setCategory(Category category) {
		this.cat = category;
	}

	public ArrayList<Reminder> getReminders() {
		return reminders;
	}

	public void setReminders(ArrayList<Reminder> reminders) {
		this.reminders = reminders;
	}

	public String getPlace() {
		return place;
	}

	public void setPlace(String place) {
		this.place = place;
	}

	public Repeat getRepeat() {
		return repeat;
	}

	public void setRepeat(Repeat repeat) {
		this.repeat = repeat;
	}

	
}
